#ifndef OPHIES_OBJECT_REQUEST_H
#define OPHIES_OBJECT_REQUEST_H

#include "irm_callbacks.h"
#include "irm_datamodel.h"
#include "irm_search.h"

#include <QObject>
#include <QUrl>
#include <QNetworkRequest>
#include <QNetworkAccessManager>
#include <QHash>
#include <QAuthenticator>

namespace ophies {

class ObjectRequest : public QObject
{
    Q_OBJECT

public:
	ObjectRequest(
		QString controllerName,
		RequestCallback *callback,
		QObject *parent);
	ObjectRequest(
		QString controllerName,
		RequestCallback *callback,
		Search* searchOptions,
		QObject *parent
		);
	virtual ~ObjectRequest();

private:
    QString m_version;
    QString m_controllerName;

	Search *m_search;
    QNetworkRequest *m_request;
    RequestCallback *m_requestCallback;
    QNetworkCookieJar *m_cookieJar;
public:
	QNetworkAccessManager *m_manager;

public:
    void setAuth(QString tokenId, QString secret);
    void setParam(QString key, QString value);

public:
    QString buildPath(QString id = "", QString action = "");
    void listObject();
    void getObject(QString id);

};

}
#endif // OPERATION_H
